package com.medical.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.medical.system.mapper.SysClientMapper;
import com.medical.system.model.Client;
import com.medical.system.service.SysClientService;
import com.medical.system.vo.ClientVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SysClientServiceImpl extends ServiceImpl<SysClientMapper,Client> implements SysClientService {

    //分页查询数据
    @Override
    public IPage<Client> selectPage(IPage<Client> iPage, ClientVo ClientVo) {
        return this.baseMapper.selectPage(iPage, ClientVo);
    }

    //更改患者状态
    @Override
    public void updateStatus(Long id, Integer status) {

        Client client = this.baseMapper.selectById(id);
        if (status instanceof Integer) {
            client.setStatus(status.intValue());
        } else if (status instanceof Number) { // 如果可能的话，处理其他数字类型
            client.setStatus(((Number)status).intValue());
        }
        this.baseMapper.updateById(client);

    }
}
